<div id="rids" class="rids" style="float:right;margin-right:310px;display:<?php echo $model->rid == null?'none':'block';?>;">(<?php echo Yii::t('tender','Rid');?><span id="showRid"><?php echo $model->rid;?></span>)</div>
	<?php echo CHtml::checkBox('retender', $model->rid==null?false:true,array('onclick'=>'getRid();')); ?>
	
	<?php
	$this->beginWidget('zii.widgets.jui.CJuiDialog', array(
		'id'=>'mydialog',
		'options'=>array(
			'title'=>Yii::t('tender','Retender List'),
			'width'=>'840',
			'autoOpen'=>false,
			'modal'=>true
		),
	));
	?>

	<script type="text/javascript">
	function getRid(){
		if($("#retender").attr("checked")){
			$("#mydialog").dialog("open"); 
			$("#retender").attr("checked",false);
		}else{
			$("#rids").hide();
			$('#Tender_rid').val("");
			$('#showRid').html("");
		}
	}
	function selecttender(id)
	{
		$('#Tender_rid').val(id);
		$('#showRid').html(id);
		$("#cid_"+id).attr("checked",false);
		$("#retender").attr("checked",true);
		$("#rids").show();
		$("#mydialog").dialog("close");
	}
	
	</script>
	<p>
	<?php Yii::t('tender','Retender describ')?> </p>
	<?php 
	$this->widget('zii.widgets.grid.CGridView', array(
		'id'=>'tenders-grid',
		'dataProvider'=>$smodel->search(),
		'filter'=>$smodel,
		'columns'=>array(
			array( 
				'value'=>'CHtml::checkBox("cid[]",null,array("value"=>$data->tid,"id"=>"cid_".$data->tid,"onclick"=>"selecttender(\"$data->tid\")"))', 
				'type'=>'raw', 
				'htmlOptions'=>array('width'=>8), 
			),
			'tid',
			array(
				'name'=>'search_project',
				'value'=>'$data->project->projectname',
				'header'=>Yii::t('tender','Pid'),
			),
			'tendername',
			array(
				'name'=>'search_tenderer',
				'value'=>'$data->tenderer->name',
				'header'=>Yii::t('tender','Tenderer'),
			),
			array(
				'name'=>'mode',
				'value'=>'Tender::itemAlias("ModeStatus",$data->mode)',
				'filter'=>Tender::itemAlias("ModeStatus"),
			),
			'saletime',
			'opentime',
		),
	)); 

	?>
	<?php
	$this->endWidget('zii.widgets.jui.CJuiDialog');
	?>
